_Pragma("once");

#include <string>

#include "SingletonTemplate.h"

#include <bits/basic_string.h>
#include <ext/new_allocator.h>

class ProcessCreator {
    friend class SingletonTemplate<ProcessCreator>;
public:

    /** Default destructor */
    ~ProcessCreator();

    int runScript(const std::string& pathFile,  const char * args[]) {

        args[1] = pathFile.data();

        return runProcess(std::string_view("/bin/bash"), std::string_view("bash"), args);
    }


    int runProcess(const std::string_view& pathFile, const std::string_view& program, const char * args[]);


    int createBackgroundProcess(const std::string_view& pathFile, const std::string_view& program, const char * args[]);

protected:

    /** Default constructor */
    ProcessCreator();

    ProcessCreator(const ProcessCreator&) = delete;
};


using ProcessCreatorSingleton = SingletonTemplate<ProcessCreator>;
